<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:p="http://primefaces.prime.com.tr/ui"
                template="#{webContext.skin0Culomns}"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:f="http://java.sun.com/jsf/core">
    <ui:define name="center">

        <h:form id="addForm">
            <p:messages id="messages" />
            <p:breadCrumb>  
                <p:menuitem value="#{ml.tr('Home')}" url="#{webContext.baseUrl}" />  
                <p:menuitem value="#{ml.tr('Action list')}" url="#{lm.ml('action/list.xhtml')}" />  
                <p:menuitem value="#{ml.tr('Add action')}" url="#" />  
            </p:breadCrumb>

            <p:toolbar>
                <p:toolbarGroup align="left">
                    <p:commandButton type="submit"
                                     value="#{ml.tr('Save')}"
                                     image="ui-icon-disk"
                                     actionListener="#{actionAdd.save}"
                                     update="messages"/>
                    <p:divider />
                </p:toolbarGroup>
            </p:toolbar>

            <p:tabView>
                <p:tab title="#{ml.tr('Info')}">
                    <h:panelGrid columns="2">
                        <h:outputText value="#{ml.tr('Name')}*: " />
                        <p:inputText value="#{actionAdd.action.name}"
                                     required="true"
                                     requiredMessage="#{ml.tr('The name is require')}"/>

                        <h:outputText value="#{ml.tr('From')}: " />

                        <p:calendar value="#{actionAdd.action.fromDate}" 
                                    pattern="#{fyxAtributes.dateFormat.value}"
                                    pages="3"
                                    locale="#{fyxAtributes.isoLanguage.value}"/>

                        <h:outputText value="#{ml.tr('To')}: " />
                        <p:calendar value="#{actionAdd.action.toDate}" 
                                    pattern="#{fyxAtributes.dateFormat.value}"
                                    pages="3"
                                    locale="#{fyxAtributes.isoLanguage.value}"/>

                        <h:outputText value="#{ml.tr('Description')}: " />
                        <p:editor value="#{actionAdd.action.description}"/>
                    </h:panelGrid>
                </p:tab>
                <p:tab title="#{ml.tr('Pricing')}">
                    <h:panelGrid columns="2">
                        <h:outputText value="#{ml.tr('Price')}:" />
                        <p:inputText value="#{actionAdd.action.price}" />

                        <h:outputText value="#{ml.tr('Member price')}:" /> 
                        <p:inputText value="#{actionAdd.action.priceMember}" />

                        <h:outputText value="#{ml.tr('Time price')}: " 
                                      title="Special time price with biger priority then standard price."/>

                        <h:panelGrid columns="5">
                            <h:outputText value="#{ml.tr('Price')}:" /> 
                            <p:inputText value="#{actionAdd.actionPrice.price}" />

                            <h:outputText value="#{ml.tr('Member price')}:" /> 
                            <p:inputText value="#{actionAdd.actionPrice.priceMember}" />

                            <h:outputText value=""/>

                            <h:outputText value="#{ml.tr('From')}" />
                            <p:calendar value="#{actionAdd.actionPrice.fromDate}"
                                        pattern="#{fyxAtributes.dateFormat.value}"
                                        pages="3"
                                        locale="#{fyxAtributes.isoLanguage.value}"/>

                            <h:outputText value="#{ml.tr('To')}" />
                            <p:calendar value="#{actionAdd.actionPrice.toDate}"
                                        pattern="#{fyxAtributes.dateFormat.value}"
                                        pages="3"
                                        locale="#{fyxAtributes.isoLanguage.value}"/>

                            <p:commandButton value="#{ml.tr('Add price')}" 
                                             update="addForm"
                                             image="ui-icon ui-icon-plus"
                                             action="#{actionAdd.addPrice}"
                                             />

                        </h:panelGrid>
                        <h:outputText value="" />
                        <p:dataTable id="priceDataTable"
                                     value="#{actionAdd.action.actionPriceCollection}"
                                     var="price" >
                            <p:column headerText="#{ml.tr('Price')}" >
                                <h:outputText value="#{price.price}" />
                            </p:column>
                            <p:column headerText="#{ml.tr('Member price')}" >
                                <h:outputText value="#{price.priceMember}" />
                            </p:column>
                            <p:column headerText="#{ml.tr('From')}" >
                                <h:outputText value="#{price.fromDate}" />
                            </p:column>
                            <p:column headerText="#{ml.tr('To')}" >
                                <h:outputText value="#{price.toDate}" />
                            </p:column>

                            <p:column headerText="#{ml.tr('Action')}" >
                                <p:commandButton title="#{ml.tr('Remove')}" 
                                                 update="addForm"
                                                 image="ui-icon ui-icon-close"
                                                 action="#{actionAdd.removePrice(price)}"/>
                            </p:column>
                        </p:dataTable>
                    </h:panelGrid>
                </p:tab>
                <p:tab title="#{ml.tr('Email notify')}">
                    <h:panelGrid columns="1" >
                        <h:panelGrid columns="2" >
                            <h:selectBooleanCheckbox />
                            <h:outputText value="Zaslat zvací dopis (bude zaslán všem)" />
                        </h:panelGrid>
                        
                    </h:panelGrid>
                </p:tab>
            </p:tabView>
        </h:form>
    </ui:define>

</ui:composition>
